]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
Fix double free and under-dup in ShellAppMonitor
authorColin Walters <walters@verbum.org>
Tue, 30 Jun 2009 21:37:27 +0000 (17:37 -0400)
committerColin Walters <walters@verbum.org>
Tue, 30 Jun 2009 22:16:39 +0000 (18:16 -0400)
The hash table is keeping ownership of appid, we don't need
to free it again.  However we do need to re-dup it when we
insert as a key.

src/shell-app-monitor.c

index 6edf824dc5ab75739a8d90cce4293473f334b0d1..87b7f6c22fa142d4e1abc91bd5a403ed6e851e59 100644 (file)
@@ -347,12 +347,12 @@ shell_app_monitor_on_window_removed (MetaWorkspace   *workspace,
   if (window_count == 0)
     {
       g_hash_table_remove (self->running_appids, appid);
-      g_free (appid);
       g_signal_emit (self, signals[CHANGED], 0);
     }
   else
     {
-      g_hash_table_insert (self->running_appids, appid, GUINT_TO_POINTER (window_count));
+      g_hash_table_insert (self->running_appids, g_strdup (appid),
+                           GUINT_TO_POINTER (window_count));
     }
   g_hash_table_remove (self->window_to_appid, window);
 }